#include  <stdio.h>
#include  <math.h>

int main(void)
{	      	  
    int i8, i5, i3, i2, i1, n8, n5, n3, n2, n1;
    double 	max = 0, total;
    for (i8 = 0; i8 < 3; i8++)
        for (i5 = 0; i5 <= (20 - 8 * i8) / 5; i5++)
            for (i3 = 0; i3 <= (20 - 8 * i8 - 5 * i5) / 3; i3++)
                for (i2 = 0; i2 <= (20 - 8 * i8 - 5 * i5 - 3 * i3) / 2; i2++)
                {	      	  
                    i1 = 20 - 8 * i8 - 5 * i5 - 3 * i3 - 2 * i2;
                    total = 2000 * pow(1 + 0.0225, i1)
                            * pow(1 + 0.0243, i2)
                            * pow(1 + 0.0270, i3)
                            * pow(1 + 0.0288, i5)
                            * pow(1 + 0.0300, i8);
                    if (total > max)
                    {	      	  
                        max = total;
                        n1 = i1;
                        n2 = i2;
                        n3 = i3;
                        n5 = i5;
                        n8 = i8;
                    }
                }
    printf("8 year: %d\n", n8);
    printf("5 year: %d\n", n5);
    printf("3 year: %d\n", n3);
    printf("2 year: %d\n", n2);
    printf("1 year: %d\n", n1);
    printf("Total: %.2f\n", max);
    return 0;
}	      	  